package org.web3j.abi.datatypes;

import org.web3j.abi.TypeReference;

import java.util.List;

import static org.web3j.abi.Utils.convert;

/**
 * Function type.
 */
public class Function {
    private String name; //函数名称
    private List<Type> inputParameters; //输入参数
    private List<TypeReference<Type>> outputParameters;//输出参数

    public Function(String name, List<Type> inputParameters,
                    List<TypeReference<?>> outputParameters) {
        this.name = name;
        this.inputParameters = inputParameters;
        this.outputParameters = convert(outputParameters);
    }

    /**
     * 适用于Seele合约
     *
     * @param name
     * @param inputParameters
     */
    public Function(String name, List<Type> inputParameters) {
        this.name = name;
        this.inputParameters = inputParameters;
    }

    public String getName() {
        return name;
    }

    public List<Type> getInputParameters() {
        return inputParameters;
    }

    public List<TypeReference<Type>> getOutputParameters() {
        return outputParameters;
    }
}
